using Admin2024.Domain.Entity.System;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders;

namespace Admin2024.EntityFrameworkCore.EntityConfiguration;

public class AppResourceConfiguration : BaseEntityConfiguration<AppResource>
{
    public override void Configure(EntityTypeBuilder<AppResource> builder)
    {
        base.Configure(builder);

        // 表名
        builder.ToTable("app_resource");

        // 每个实体只需要配置自有属性即可，数据库列顺序从3开始
        builder.Property(p => p.ResourceName)
        .HasColumnName("resource_name")
        .HasComment("资源名称")
        .HasColumnOrder(3);

        builder.Property(p => p.Url)
        .HasColumnName("url")
        .HasComment("访问地址")
        .HasColumnOrder(4); 

    }
}